var merge = require('webpack-merge'),
    webpack = require('webpack'),
    path = require('path'),
    contextPath = path.join(__dirname, '../'),
    srcPath = path.resolve(contextPath,'src'),
    distPath = path .resolve(contextPath,'dist'),
    common = require('./webpack.common.js'),
    postcss = require('postcss-loader');


console.log("++++ development  running ++++");
console.log("++++ development  running ++++");

module.exports = merge(common, {
  devtool: 'inline-source-map',
  output:{
      path:distPath,
      publicPath:'http://localhost:8080/',
      filename:'static/js/[name].[hash:6].js'
  },
  module:{
        rules:[
            {
                test: /\.vue$/,
                loader: 'vue-loader',
                options: {
                    loaders: {
                    // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
                    // the "scss" and "sass" values for the lang attribute to the right configs here.
                    // other preprocessors should work out of the box, no loader config like this nessessary.
                    'scss': 'vue-style-loader!css-loader!sass-loader',
                    'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
                    }
                    // other vue-loader options go here
                }
            },
            {
                test:/\.css$/,
                use:['style-loader','css-loader'],
                exclude: /node_modules/
            },
            {
                test:/\.(png|svg|gif|jpg|woff|woff2|eot|ttf|otf)(\?\S*)?$/,
                use:[
                        {
                          //dev环境 对于output.path 即使不用file-loader也需要安装此包
                          loader:'url-loader',
                          options:{
                            limit:'8',
                            name:'static/img/[hash:6].[ext]'
                          }
                        }
                ],
                exclude: /node_modules/
            },
        ]
    },
  devServer: {
    hot:true
  },
  plugins:[
    new webpack.HotModuleReplacementPlugin() // 热加载
  ]
});